import state from './state'
import UPDATESTULIST,{INITSTULIST,DELETESTULIST} from './constant'
function stuReducer(initState=state,action) {
    let {type, payload} = action
    // console.log('action:>>>',action)
    switch(type) {
        case INITSTULIST:
            return {
                ...initState,
                stuList: payload
            }
        // case UPDATESTULIST:
        //     return {
        //         ...initState,
        //         stuList: initState.stuList.filter(item => item.id !== payload.id)
        //     }
        case DELETESTULIST:
            return {
                ...initState,
                stuList: initState.stuList.filter(item => item.id !== payload.id)
            }
    }
}
export default stuReducer